package routes

import (
	"ginblog/api/admin/v1"
	v12 "ginblog/api/common/v1"
	"ginblog/middleware"
	"github.com/gin-gonic/gin"
)

func AdminV1(admin *gin.RouterGroup) {
	v1NoToken := admin.Group("v1")
	{
		v1NoToken.POST("login", v1.Login)
	}

	v1UseToken := admin.Group("v1")
	v1UseToken.Use(middleware.JwtToken())
	{
		//-------用户相关

		v1UseToken.POST("upInfo", v1.UpdateUserInfo)

		//--------设置相关

		//获取设置
		v1UseToken.POST("setup", v12.SetUp)
		//编辑设置
		v1UseToken.POST("editSetup", v12.EditSetup)

		//--------文章相关

		//获取文章
		v1NoToken.POST("art", v12.ArticleList)
		//新增文章
		v1UseToken.POST("addArt", v12.AddArticle)
		//编辑文章
		v1UseToken.POST("editArt", v12.EditArticle)
		//删除文章
		v1UseToken.POST("delArt", v12.DelArticle)

		//--------标签相关

		//获取标签
		v1NoToken.POST("tag", v12.TagList)
		//新增标签
		v1UseToken.POST("addTag", v12.AddTag)
		//编辑标签
		v1UseToken.POST("editTag", v12.EditTag)
		//删除标签
		v1UseToken.POST("delTag", v12.DelTag)

		//--------文章分类相关

		//获取文章分类
		v1NoToken.POST("artCat", v12.ArticleCategoryList)
		//新增文章分类
		v1UseToken.POST("addArtCat", v12.AddArticleCategory)
		//编辑文章分类
		v1UseToken.POST("editArtCat", v12.EditArticleCategory)
		//删除文章分类
		v1UseToken.POST("delArtCat", v12.DelArticleCategory)

		//--------资源相关
		v1UseToken.POST("uploadRes", v12.UploadRes)
	}
}
